#-------------------------------------------------
#
# Project created by QtCreator 2020-08-01T15:25:33
#
#-------------------------------------------------

QT       += core gui
QT += axcontainer
QT += serialport
#QT  += xlsx

RC_FILE = pic.rc

msvc {
    QMAKE_CFLAGS += /utf-8
    QMAKE_CXXFLAGS += /utf-8
}

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = channeltool
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0

include(3rdparty/qtxlsx/src/xlsx/qtxlsx.pri)

SOURCES += \
        main.cpp \
        mainwindow.cpp \
    showret.cpp \
    usb_listener.cpp \
    showinfo.cpp \
    readfile.cpp \
    login.cpp \
    wthread.cpp \
    areaconfig.cpp \
    pollthread.cpp \
    add_d_ch.cpp \
    add_a_ch.cpp \
    moddata.cpp \
    grouplist.cpp

HEADERS += \
        mainwindow.h \
    showret.h \
    usb_listener.h \
    showinfo.h \
    readfile.h \
    login.h \
    wthread.h \
    areaconfig.h \
    pollthread.h \
    add_d_ch.h \
    add_a_ch.h \
    moddata.h \
    grouplist.h

FORMS += \
        mainwindow.ui \
    showret.ui \
    usb_listener.ui \
    showinfo.ui \
    readfile.ui \
    login.ui \
    areaconfig.ui \
    add_d_ch.ui \
    add_a_ch.ui \
    moddata.ui \
    grouplist.ui

RESOURCES += \
    res.qrc

# 下面的为通用模板
contains(QT_ARCH, x86_64) {
    message("x64")
    # 输出目录
    CONFIG(debug, debug|release) {
        DESTDIR = $$PWD/../$${TARGET}/win/x64/debug
    } else {
        DESTDIR = $$PWD/../$${TARGET}/win/x64/release
    }
} else {
    message("x86")
    # 输出目录
    CONFIG(debug, debug|release) {
        DESTDIR = $$PWD/../$${TARGET}/win/x86/debug
    } else {
        DESTDIR = $$PWD/../$${TARGET}/win/x86/release
    }
}

# 将给定文件复制到目标目录，相当于一个函数
defineTest(copyToDestDir) {
    files = $$1
    dir = $$2
    # 替换Windows目标路径中的斜杠
    win32:dir ~= s,/,\\,g

    for(file, files) {
        # 替换Windows源路径中的斜杠
        win32:file ~= s,/,\\,g

        # 复制命令
        QMAKE_POST_LINK += $$QMAKE_COPY $$shell_quote($$file) $$shell_quote($$dir) $$escape_expand(\\n\\t)
    }

    export(QMAKE_POST_LINK)
}


CONFIG_FILES_TOCOPY +=\
    $$PWD/config.ini \
    $$PWD/icon.ico \
    $$PWD/ima/timg.jpg



copyToDestDir($$CONFIG_FILES_TOCOPY,$$DESTDIR)


